import { defineConfig } from 'vite'

import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'

import styleImport from 'vite-plugin-style-import'

import config from './config'

const path = require('path')

// import { DEFAULT_ASSETS_RE } from './constants.js'

let NODE_ENV = 'production'

if (process.env.NODE_ENV === 'development') NODE_ENV = 'development'

export default defineConfig({
  mode: NODE_ENV,
  // base: '/',
  logLevel: 'info',
  define: true,
  plugins: [
    vue(),
    vueJsx({}), // 专用的 Babel 转换插件
    styleImport({
      libs: []
    })
  ],

  // assetsInclude: [DEFAULT_ASSETS_RE],

  resolve: {
    alias: [{
        find: '@',
        replacement: path.join(__dirname, '.', 'src')
      }
      //   {
      //     find: 'vue-i18n',
      //     replacement: 'vue-i18n/dist/vue-i18n.cjs.js'
      //   }
    ]
  },
  server: config.server,
  build: config.build
})
